package edu.hunau.cxb19.oop.class05.hk;

/**
 * 单选题
 * 
 * @author hb
 *
 *         2020-02-28 15:17:20
 */
public class SingleQuestion extends Question {
	private char answer;// 表示标准答案

	/**
	 * 
	 */
	public SingleQuestion() {

	}

	/**
	 * @param id
	 * @param options
	 * @param text
	 */
	public SingleQuestion(int id, String[] options, String text, char answer) {
		super(id, options, text);
		setAnswer(answer);

	}

	@Override
	public boolean check(char[] answers) {
		if (answers.length != 1) {
			return false;
		}
		return answer == answers[0];
	}

	/**
	 * @return the answer
	 */
	public char getAnswer() {
		return answer;
	}

	/**
	 * @param answer the answer to set
	 */
	public void setAnswer(char answer) {
		this.answer = answer;
	}

}
